<template>
  <!-- 内容审核页 -->
  <div class="content-check-wapper">
    <!-- 查询条件 -->
    <el-form
      :inline="true"
      :model="searchCondition"
      ref="activityView">
      <!-- <el-form-item label="菜单名称" prop="activityName" class="el-col-10">
        <el-input v-model="searchCondition.activityName" @keyup.enter.native="handleSearch"></el-input>
      </el-form-item> -->
      <el-form-item
        label="审核状态"
        prop="flag">
        <el-select
          v-model="searchCondition.flag"
          clearable
          @change="handleFlagChange"
        >
          <el-option
            label="审核通过"
            value="0"/>
          <el-option
            label="待审核"
            value="1"/>
          <el-option
            label="驳回"
            value="2"/>
          <el-option
            label="全部"
            value="3"/>
        </el-select>
      </el-form-item>
      <el-form-item prop="sn8">
        <sn8-select
          @change="sn8Changed"
          :sn8.sync="searchCondition.sn8"
        />
      </el-form-item>
      <el-form-item label="">
        <el-button
          type="primary"
          @click="handleSearch">查询</el-button>
        <el-button @click="resetForm">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- 数据列表 | 表格显示区 -->
    <div class="table-wapper">
      <el-table
        :data="tableMsg"
        tooltip-effect="light"
        style="width: 100%;"
        border
        v-loading="loading"
      >
        <el-table-column
          align="center"
          type="index"
          label="序号"
          width="50"/>
        <el-table-column
          :label="$t('img')"
          align="center"
          width="120">
          <template slot-scope="scope">
            <div
              class="text-center is-align-middle is-justify-center el-row--flex"
            >
              <midea-admin-image
                :height="100"
                :previewable="true"
                :url="scope.row.showpic_url"
                :width="100"
              />
            </div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          :label="$t('user.username')"
          width="200">
          <template slot-scope="scope">
            <div style="width: 160px;">{{ scope.row.userName }}</div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          :label="$t('model.createTime')"
          width="200">
          <template slot-scope="scope">
            <div style="width: 160px;">{{ scope.row.create_time }}</div>
          </template>
        </el-table-column>
        <el-table-column
          align="center"
          :label="$t('user.status')"
          width="200">
          <template slot-scope="scope">
            <div
              v-if="scope.row.flag == 0"
              style="width: 160px;">审核通过</div>
            <div
              v-if="scope.row.flag == 1"
              style="width: 160px;">待审核</div>
            <div
              v-if="scope.row.flag == 2"
              style="width: 160px;">驳回</div>
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('handle')"
          align="center"
          fixed="right"
          header-align="center"
        >
          <template slot-scope="scope">
            <!--            :class="{
                active:
                  item.active.includes(scope.row.flag) &&
                  (item.key === 'finish'
                    ? scope.row.isActivityEnd === 'Y'
                    : true)
              }"-->
            <el-button
              size="small"
              :type="item.type"
              :plain="item.plain"
              class="check-operate"
              v-for="item in operateOptions"
              v-if="item.show.includes(scope.row.flag)"
              :key="item.value"
              @click="
                handleDetail(
                  scope,
                  item.key,
                  item.active.includes(scope.row.flag)
                )
              "
            >{{ item.label }}</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
    <!-- pagination -->
    <div class="table-pagination">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="tablePage.currentPage"
        :page-sizes="[10, 20, 50, 100, 200]"
        :page-size="tablePage.pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="tablePage.total"
      />
    </div>
    <!-- dialog -->
    <picture-dialog
      :dialog-form-visible="dialogFormVisible"
      :dialog-item="dialogItem"
      @dialogCallback="dialogHandle"
    />
  </div>
</template>

<script>
import mixinPictureModule from '@/mixins/content-audit/picture-check'
import mixinMikeModule from '@/mixins/mike.view-module'
import PictureDialog from '@/components/mike/pictureDialog'
import Sn8Select from '@/components/sn8.select'

export default {
  mixins: [mixinPictureModule, mixinMikeModule],
  components: {
    PictureDialog,
    Sn8Select
  },
  created () {
    this.initTableData()
  },
  methods: {
    sn8Changed () {
      this.handleSearch()
    }
  }
}
</script>

<style lang="scss" scoped>
.el-col-10 {
  .el-input {
    width: 250px;
  }
}
.check-operate {
  /*color: #ccc;*/
  /*margin: 0 5px;*/
  /*&.active {*/
  /*  color: #7382fc;*/
  /*  text-decoration: underline;*/
  /*  cursor: pointer;*/
  /*}*/
}
</style>
